package com.mq.Mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface FlightMapper {
    @Select("select flight_id, flight_no, departure_city, arrival_city, departure_time, arrival_time, aircraft_type, total_seats, available_seats, base_price from flights where arrival_city=#{destination} and total_seats>0")
    List<Map<String, Object>> getFlightsList(String destination);

    @Select("select available_seats from flights where flight_id=#{flightId}")
    int cheakNumTicket(Integer flightId);

    @Select("update flights set available_seats=#{available_seat} where flight_id=#{flightId} ")
    void setSeat(Integer flightId, Integer available_seat);
    @Select("select base_price from flights where flight_id=#{flightId}")
    Double flightPrice(Integer flightId);

}
